package day1103.demo02;

/**
 * @program: qy158
 * @description:
 * @author: 闫克起2
 * @create: 2022-11-03 09:29
 **/
public class Test {
    public static void main(String[] args) {
        Swimming s=new Swimming() {
            @Override
            public void swiming() {
                System.out.println("~~~~~~~~~~~~匿名内部类");
            }
        };
        fun(s);


        Swimming s2=()->System.out.println("lambda表达式============");

        fun(s2);

    }

    //定义一个方法---传递的参数为接口类型---函数式接口
    public static void fun(Swimming s){
          s.swiming();
    }
}
//它就是函数式接口
@FunctionalInterface
interface Swimming{
    public void swiming();
}
